package io.summer.basis.core;

import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.context.ApplicationPidFileWriter;
import org.springframework.context.ConfigurableApplicationContext;

/**
 * @author Moonlight
 */
@Slf4j
public final class ApplicationRunner {
  private ApplicationRunner() {}
  public static <T> ConfigurableApplicationContext run(Class<T> application, String[] args) {
    SpringApplication app = new SpringApplication(application);
    app.addListeners(new ApplicationPidFileWriter());
    return app.run(args);
  }
}
